<template>
  <div>
    <h1>课程缴费</h1>
    学号:<el-input size="medium" v-model="sno" placeholder="学号"></el-input>
    课程号:<el-input size="medium" v-model="cno" placeholder="课程号"></el-input>
    费用:<el-input size="medium" v-model="aamount" placeholder="费用"></el-input>
    <el-row>
      <el-button @click="pay" type="primary" plain>支付</el-button>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Pay",
  data() {
    return {
      sno:'',
      cno:'',
      aamount:'',
    }
  },
  // created(){
  //   this.cno = this.$route.query.cno;
  //   this.stuNo = this.$route.query.stuNo;
  //   console.log(this.cno);
  //   console.log(this.stuNo);
  //   this.$axios.get(`/course/info?cno=${this.cno}`).then((res) => {
  //     console.log(res.data);
  //     this.amount = res.data.camount;
  //     this.cname = res.data.cname;
  //
  //   })
  // },
  methods: {
    pay(){
      // alert(123);
      let parmas = {
        sno:this.sno,
        cno:this.cno,
        aamount:this.aamount,
      }
      this.$axios.post(`http://localhost:8081/Pay`, parmas).then((res) => {
        console.log(res);
        if("支付成功" === res.data.msg){
          alert("缴费成功");
          // this.$router.push({path:'/MyCourse',query:{
          //     stuNo:this.stuNo
          //   }});
        }else{
          alert(res.data.msg);
        }
      });
    }
  }
}
</script>

<style scoped>

</style>
